/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Controllers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author BENSON
 */
public class ControllrerAddDoctor {
     /**
     * variable and views declarations
     */
    Views.AddDoctor addDoc;
    Model.MainModel model;
    private ActionListener actionListener;
    
    
    /**
     * Default constructor for instantiating declared views
     */
    
public ControllrerAddDoctor( ){
        addDoc = new Views.AddDoctor();
        addDoc.setVisible(true);
        model=new Model.MainModel();
}     
    
    /**
     * Method to add action listener to clicked buttons
     */

public void control(){        
        actionListener = new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent actionEvent) {  
                  if(actionEvent.getSource()==addDoc.getSaveBtn()){
                        model.addDoctors(addDoc);
                  }
                  if(actionEvent.getSource()==addDoc.getCloseBtn()){
                  addDoc.setVisible(false);
                  
                  }
               }
              
        };                
        addDoc.getSaveBtn().addActionListener(actionListener);
        addDoc.getCloseBtn().addActionListener(actionListener);
        
}
    
}
